package edu.washington.ling.syntric.struct.projection;

import java.util.List;
import java.util.LinkedList;

public class BiProjectionNode extends ProjectionNode implements Cloneable {
	private List<List<ProjectionNode>> leftDependentForests;
	private List<List<ProjectionNode>> rightDependentForests;
	
	public BiProjectionNode(List<String> rootLbls, String headChildLbl) {
		super(rootLbls, headChildLbl);
		leftDependentForests = new LinkedList<List<ProjectionNode>>();
		rightDependentForests = new LinkedList<List<ProjectionNode>>();
	}
	
	public void setLeftDependentForests(List<List<ProjectionNode>> depForests) {
		leftDependentForests = depForests;
	}
	public void setRightDependentForests(List<List<ProjectionNode>> depForests) {
		rightDependentForests = depForests;
	}
	public void insertLeftDependentForest(List<ProjectionNode> depForest) {
		leftDependentForests.add(0, depForest);
	}
	
	public void insertRightDependentForest(List<ProjectionNode> depForest) {
		rightDependentForests.add(0, depForest);
	}
	
	public List<List<ProjectionNode>> getLeftDependentForests() {
		return leftDependentForests;
	}
	
	public List<List<ProjectionNode>> getRightDependentForests() {
		return rightDependentForests;
	}
	public List<ProjectionNode> getInnerLeftDependentForest() {
		return leftDependentForests.get(0);
	}
	
	public List<ProjectionNode> getInnerRightDependentForest() {
		return rightDependentForests.get(0);
	}
	public boolean hasLeftDependentForests() {
		return (leftDependentForests.size() > 0);
	}
	public boolean hasRightDependentForests() {
		return (rightDependentForests.size() > 0);
	}
	@Override
	public BiProjectionNode clone() {
		BiProjectionNode copy = new BiProjectionNode(this.getRootLabels(), this.getHeadChildLabel());
		copy.setLeftDependentForests(this.getLeftDependentForests());
		copy.setRightDependentForests(this.getRightDependentForests());
		return copy;
	}
}
